<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改</title>
    <link rel="stylesheet" href="../../assets/libs/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="">
<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">Id</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" id="uId" name="uId" lay-verify="title" autocomplete="off" placeholder="请输入编号" class="layui-input" readonly>-->
<!--        </div>-->
<!--    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">职员姓名</label>
        <div class="layui-input-block">
            <input type="text" id="eName" name="EName" lay-verify="title" autocomplete="off" placeholder="请输入姓名" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" id="eGender1" name="EGender" value="男" title="男" checked>
            <input type="radio" id="eGender2" name="EGender" value="女" title="女">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-block">
            <input type="text" id="eAge" name="EAge" lay-verify="title" autocomplete="off" placeholder="请输入年龄" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">生日</label>
            <div class="layui-input-block">
                <input type="text"  name="EBirthday" id="date1" autocomplete="off" class="layui-input">
            </div></div></div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">职位</label>
            <div class="layui-input-inline">
                <input type="text" id="eJob" name="EJob" lay-verify="job" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">工作地点</label>
        <div class="layui-input-block">
            <input type="text" id="eLocation" name="ELocation" lay-verify="title" autocomplete="off" placeholder="请输入姓名" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script src="../../assets/libs/layui/layui.js"></script>
<script src="../../assets/js/my.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,$=layui.jquery
            ,laydate = layui.laydate;
        laydate.render({
            elem: '#date1'
        });
        // form.verify({
        //     title: function(value){
        //         if(value.length < 5){
        //             return '标题至少得5个字符啊';
        //         }
        //     }
        //
        //     ,content: function(value){
        //         layedit.sync(editIndex);
        //     }
        // });

        //日期
        laydate.render({
            elem:'#date1'
        });

        form.on('submit(demo1)', function(data){
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            $.get(host+'/employeeservlet/save',data.field,function (r) {
                if(r.code==0){
                   layer.msg("添加成功",{icon:1})
                }else{
                    layer.msg("添加失败",{icon:2})
                }
            })
        });
    })
</script>
</html>